#include "doctorwidget.h"

#include "config.h"

#include "datewidget.h"

DoctorWidget::DoctorWidget()
{

}

int DoctorWidget::exec()
{
    int state;
    bool flag = false;

    while(1)
    {
        Bmp b1("./res/doctor.bmp");
        b1.show(199,50);

        Touch touch;
        int x,y;
        touch.wait(x,y);

        if(x>290 && x<410 && y>220 && y<260) //预约挂号按钮1
            state = Doctor_Mode_Prepare_Register1;
        else if(x>580 && x<710 && y>220 && y<260) //预约挂号按钮2
            state = Doctor_Mode_Prepare_Register2;
        else if(x>580 && x<710 && y>220 && y<260) //上一页
            state = Doctor_Mode_Prev;
        else if(x>580 && x<710 && y>220 && y<260)//下一页
            state = Doctor_Mode_Next;
        else{//空白地方
            state = Doctor_Mode_Other;
        }

        switch (state) {
            case Doctor_Mode_Prepare_Register1:
            case Doctor_Mode_Prepare_Register2:
                    {
                        DateWidget widget;
                        if(widget.exec() == Btn_OK)
                            return Btn_OK;
                    }
                    break;
            case Doctor_Mode_Prev:
                    break;
            case Doctor_Mode_Next:
                    break;
            case Doctor_Mode_Other:
                    flag = true;
                    break;
        }

        if(flag)
            break;
    }

    return state;
}
